-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Video Block: add raw transformation from video
html
#47159
Conversation
Size Change: +157 B (0%) Total Size: 1.69 MB
ℹ️ View Unchanged
|
78b2f7f
to
3a1c0ab
Compare
Flaky tests detected in 78b2f7f55549a9fe65cae9e8e39a13d531221061. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/3917556873
|
b61be71
to
5276f01
Compare
5276f01
to
32d3081
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @t-hamano!
Thanks for the review, @Mamaduka! Just to be sure, I would like to merge the latest trunk into this PR, test it again, and if there are no problems, I would like to merge it. |
Thanks for implementing a fix for this! I had a local transformation in place which achieved similar, but also added |
@codebymikey Thank you for your great exploration! I created a test page and tried your code, but it didn't work. From what I've researched, the Clipboard API doesn't seem to recognize either 517516a7931c901b93b4caaf10a6e807.mp4 |
On further investigation, it seems to be because of the way the transform works, the gutenberg/packages/dom/src/phrasing-content.js Lines 113 to 125 in 23c3a67
to be similar to this And re the Clipboard API: it's more for if you copy the actual HTML source (with sources and tracks) into the editor rather than for rendered videos. You ideally shouldn't lose that information on paste. |
Thank you for your explanation. It seems that other blocks can correctly convert HTML strings. Regarding the Video block, we may be able to deal with it through follow-up. 2f1b61ffb5c99ac0d7667486f4bc7dd8.mp4 |
Closes: #42768
What?
This PR adds a transformation that generates a video block from HTML containing a
video
element.Why?
Since
core/image
andcore/embed
support transformation from raw HTML, it would make sense to add similar support for the video block.How?
Inherits as many attributes supported by the Video block as possible, including the
src
attribute of thevideo
element. However, thesrc
attribute is assumed to be attached to thevideo
tag, and thesource
tag inside thevideo
tag is not considered.This is because the Clipboard API itself doesn't seem to pick up elements inside the
video
tag. The screencast below shows that when you copy HTML containing avideo
element with asource
element, the clipboard does not contain thesource
element.008e760e11bb165547d74eab80e1a6bc.mp4
Testing Instructions
Screencast
7e54473e3614b35c5414b8b194d0286a.mp4